<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/25
 * Time: 11:27
 */

namespace app\index\controller;

use Gregwar\Captcha\CaptchaBuilder;
use think\Controller;
use think\Db;
use think\Cache;

class User extends Controller
{

    public function index()
    {
        $a = 'hello';
        return $this->fetch('user/index', [
            'a' => $a,
        ]);
        //http://www.tp5.com/user/index
    }

    public function userList()
    {
        $data = Db::table('user')->where('id', 1)->find();
        //Cache::set('name',$value,3600);
        dump($data);
        //Session::set('name','thinkphp');
        //dump(Session::get('name'));

    }

    public function captcha()
    {
        ob_get_clean();
        header('Content-type: image/jpeg');
        $builder = new CaptchaBuilder;
        $builder->build();
        $builder->output();

    }

}
